home *** CD-ROM | disk | FTP | other *** search
/ Champak 128 / Vol 128 (Damaged).iso / games / boiler_b.swf / scripts / DefineSprite_218 / frame_1 / DoAction.as
Encoding:
Text File  |  2011-03-26  |  905 b   |  52 lines

  1. var pNum = Number(this._name.slice(6,-3));
  2. var pState;
  3. var pX;
  4. var pY;
  5. var pSpeed;
  6. this.setPos = function(ty, tdir)
  7. {
  8.    this._x = pX + 38;
  9.    this._y = pY - ty;
  10. };
  11. this.onEnterFrame = function()
  12. {
  13.    var _loc1_ = this;
  14.    if(pState == "active")
  15.    {
  16.       pX += pSpeed;
  17.       if(pX < 0 || pX > 740)
  18.       {
  19.          _loc1_.setUp();
  20.       }
  21.       else if(_loc1_.hitTest(_loc1_._parent.bod_mc.pete_mc.hitarea_mc))
  22.       {
  23.          _loc1_._parent.bod_mc.hitMe("bullet");
  24.          _loc1_.setUp();
  25.       }
  26.    }
  27. };
  28. this.setUp = function()
  29. {
  30.    var _loc1_ = this;
  31.    _loc1_.pState = "idle";
  32.    _loc1_.pX = -500;
  33.    _loc1_.pY = 10 * pNum;
  34. };
  35. this.fire = function(x, y, dir)
  36. {
  37.    pX = x;
  38.    pY = y;
  39.    pSpeed = dir;
  40.    if(pSpeed > 0)
  41.    {
  42.       this._xscale = -100;
  43.    }
  44.    else
  45.    {
  46.       this._xscale = 100;
  47.    }
  48.    pState = "active";
  49. };
  50. this.setUp();
  51. stop();
  52.